<template>
  <div
    class="sidebarItem"
    :class="activeInx == index ? 'active' : ''"
    @click="click"
  >
    <span  class="icon-font" v-if="data.iconType=='pic'">
      <img v-if="activeInx != index" :src="data.pic.defaultIcon" />
      <img v-else :src="data.pic.icon" />
    </span>
    <span class="icon-font" v-else>
      <i :class="['icon',data.iconFont]"></i>
    </span>
    <span class="title-content">{{ data.title }}</span>
  </div>
</template>

<script>
export default {
  name: "sidebarItem",
  props: {
    data: Object,
    index: Number,
    activeInx: Number,
  },
  data: function () {
    return {};
  },
  methods: {
    click: function () {
      this.$emit("item-click", this.index);
    },
  },
};
</script>

<style lang="scss" scoped>
@import "@/assets/scss/components/sidebarItem.scss";
</style>
